home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / fish / 001-100 / 001-025 / 002 / dbug / makefile < prev    next >
Makefile  |  1995-03-17  |  4KB  |  205 lines

  1. #
  2. #  FILE
  3. #
  4. #    Makefile    Makefile for dbug package
  5. #
  6. #  SCCS ID
  7. #
  8. #    @(#)Makefile    1.10 12/25/85
  9. #
  10. #  DESCRIPTION
  11. #
  12. #    Makefile for the dbug package (under UNIX system V or 4.2BSD).
  13. #
  14. #    Interesting things to make are:
  15. #
  16. #    lib    =>    Makes the runtime support library in the
  17. #            current directory.
  18. #
  19. #    lintlib    =>    Makes the lint library in the current directory.
  20. #
  21. #    install    =>    Install pieces from current directory to
  22. #            where they belong.
  23. #
  24. #    doc    =>    Makes the documentation in the current
  25. #            directory.
  26. #
  27. #    clean    =>    Remove objects, temporary files, etc from
  28. #            current directory.
  29. #
  30. #    superclean =>    Remove everything except sccs source files.
  31. #            Uses interactive remove for verification.
  32.  
  33. AR =        ar
  34. RM =        rm
  35. CFLAGS =    -O
  36. GFLAGS =    -s
  37. INSTALL =    ./install.sh
  38. CHMOD =        chmod
  39. MAKE =        make
  40. INC =        /usr/include/local
  41. LIB =        /usr/lib
  42. RANLIB =    ./ranlib.sh
  43. MODE =        664
  44.  
  45. # The following is provided for example only, it is set by "doinstall.sh".
  46. LLIB =        /usr/lib
  47.  
  48. .SUFFIXES:    .r .r~ .c .c~
  49.  
  50. .c~.c:
  51.         $(GET) $(GFLAGS) -p $< >$*.c
  52.  
  53. .r~.r:
  54.         $(GET) $(GFLAGS) -p $< >$*.r
  55.  
  56. .c~.r:
  57.         $(GET) $(GFLAGS) -p $< >$*.c
  58.         sed "s/\\\/\\\e/" <$*.c >$*.r
  59.         $(RM) -f $*.c
  60.  
  61. .c.r:
  62.         sed "s/\\\/\\\e/" <$< >$*.r
  63.  
  64. EXAMPLES =    example1.r example2.r example3.r
  65. OUTPUTS =    output1.r output2.r output3.r output4.r output5.r
  66.  
  67. NROFF_INC =    main.r factorial.r $(OUTPUTS) $(EXAMPLES)
  68.  
  69.  
  70. #
  71. #    The default thing to do is remake the local runtime support
  72. #    library, local lint library, and local documentation as
  73. #    necessary.
  74. #
  75.  
  76. all :        scripts lib lintlib doc
  77.  
  78. lib :        libdbug.a
  79.  
  80. lintlib :    llib-ldbug.ln
  81.  
  82. doc :        factorial user.t
  83.  
  84. #
  85. #    Make the local runtime support library "libdbug.a" from
  86. #    sources.
  87. #
  88.  
  89. libdbug.a :    dbug.o
  90.         rm -f $@
  91.         $(AR) cr $@ $?
  92.         $(RANLIB) $@
  93.  
  94. #
  95. #    Clean up the local directory.
  96. #
  97.  
  98. clean :
  99.         $(RM) -f *.o *.ln *.a *.BAK nohup.out factorial $(NROFF_INC)
  100.  
  101. superclean :
  102.         $(RM) -i ?[!.]*
  103.  
  104. #
  105. #    Install the new header and library files.  Since things go in
  106. #    different places depending upon the system (lint libraries
  107. #    go in /usr/lib under SV and /usr/lib/lint under BSD for example),
  108. #    the shell script "doinstall.sh" figures out the environment and
  109. #    does a recursive make with the appropriate pathnames set.
  110. #
  111.  
  112. install :        scripts
  113.             ./doinstall.sh $(MAKE) sysinstall
  114.  
  115. sysinstall:        $(INC) $(INC)/dbug.h $(LIB)/libdbug.a \
  116.             $(LLIB)/llib-ldbug.ln $(LLIB)/llib-ldbug
  117.  
  118. $(INC) :
  119.             -if test -d $@ ;then true ;else mkdir $@ ;fi
  120.  
  121. $(INC)/dbug.h :        dbug.h
  122.             $(INSTALL) $? $@
  123.             $(CHMOD) $(MODE) $@
  124.  
  125. $(LIB)/libdbug.a :    libdbug.a
  126.             $(INSTALL) $? $@
  127.             $(CHMOD) $(MODE) $@
  128.  
  129. $(LLIB)/llib-ldbug.ln :    llib-ldbug.ln
  130.             $(INSTALL) $? $@
  131.             $(CHMOD) $(MODE) $@
  132.  
  133. $(LLIB)/llib-ldbug :    llib-ldbug
  134.             $(INSTALL) $? $@
  135.             $(CHMOD) $(MODE) $@
  136.  
  137. #
  138. #    Make the local lint library.
  139. #
  140.  
  141. llib-ldbug.ln :     llib-ldbug
  142.             ./mklintlib.sh $? $@
  143.  
  144. #
  145. #    Make the test/example program "factorial".
  146. #
  147. #    Note that the objects depend on the LOCAL dbug.h file and
  148. #    the compilations are set up to find dbug.h in the current
  149. #    directory even though the sources have "#include <dbug.h>".
  150. #    This allows the examples to look like the code a user would
  151. #    write but still be used as test cases for new versions
  152. #    of dbug.
  153.  
  154. factorial :    main.o factorial.o libdbug.a
  155.         $(CC) -o $@ main.o factorial.o libdbug.a
  156.  
  157. main.o :    main.c dbug.h
  158.         $(CC) $(CFLAGS) -c -I. main.c
  159.  
  160. factorial.o :    factorial.c dbug.h
  161.         $(CC) $(CFLAGS) -c -I. factorial.c
  162.  
  163.  
  164. #
  165. #    Rebuild the documentation
  166. #
  167.  
  168. user.t :    user.r $(NROFF_INC)
  169.         nroff -cm user.r >$@
  170.  
  171. #
  172. #    Run the factorial program to produce the sample outputs.
  173. #
  174.  
  175. output1.r:    factorial
  176.         factorial 1 2 3 4 5 >$@
  177.  
  178. output2.r:    factorial
  179.         factorial -#t:o 2 3 >$@
  180.  
  181. output3.r:    factorial
  182.         factorial -#d:t:o 3 >$@
  183.  
  184. output4.r:    factorial
  185.         factorial -#d,result:o 4 >$@
  186.  
  187. output5.r:    factorial
  188.         factorial -#d:f,factorial:F:L:o 3 >$@
  189.  
  190. #
  191. #    All files included by user.r depend on user.r, thus
  192. #    forcing them to be remade if user.r changes.
  193. #
  194.  
  195. $(NROFF_INC) :    user.r
  196.  
  197. #
  198. #    Make scripts executable (safeguard against forgetting to do it
  199. #    when extracting scripts from a source code control system.
  200. #
  201.  
  202. scripts:
  203.         chmod a+x *.sh
  204.  
  205.